Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CBA UI - params support in code exec #48

Merged
merged 1 commit into from
Jun 2, 2015
Merged

CBA UI - params support in code exec #48

merged 1 commit into from
Jun 2, 2015

Conversation

SzwedzikPL
Copy link
Contributor

Support for params in cba ui with backwards compatibility

Example:

[
    ["Menu Caption", "flexiMenu resource dialog", "optional icon folder", menuStayOpenUponSelect],
    [
        [
            "caption",
            [name player, {hint format ["my name is %1", _this];}],
            "icon",
            "tooltip",
            {"submenu"|["menuName", "", {0/1}]},
            -1,
            {0|1/"0"|"1"/false|true},
            {-1|0|1/"-1"|"0"|"1"/false|true}]
    ]
]

@Dr-Eyeball
Copy link

Edit: Sorry, didn't see there were commits already. So it applies to code line only.
Can't quite work out why it is required. I will evaluate it further first.

This task needs further clarification.
Where are the param's required to be used/applied, just the "code" line?

  • AFAIK, param's already work with the 2nd "code" line, since all code lines are compiled and executed at the time of selection of the menu option.
    • (So even if the player name, or the variable used in the code line, should change in the meantime while the menu is displayed, it will already use the latest name/variable value at the time of execution.)
Eg:
{hint format ["my name is %1", name player},
{hint format ["my name is %1", TAG_playerNameVar},

Unless you are requesting for real-time processing of parameters, for real-time refreshing, so it:

  • refreshes the menu option captions in real time, even after the menu is drawn the first time.
  • refreshes the menu title caption in real time.
  • real-time enabling/disabling of menu options.
  • real-time visibility of menu options.
    • (This could be tricky, unless maybe it uses the "-1" style of skipping hidden options, which might be cleaner.)

@SzwedzikPL
Copy link
Contributor Author

It was made to add support for local variables in actions. It's "must have" for me now when im using scripts to generate "dynamic" menu for some objects. Now script can pass params to action like this:

[[_paramOne, _paramTwo], myFnc]

Real-time processing of parameters would be nice also :) It can solve problem when some option which was active when menu was opened shouldnt be active i.e. after 5 sec becouse the situation has changed. For now im solving this with closing and reopening menu but its a bit uncomfortable.

@Dr-Eyeball
Copy link

I didn't even know local var's could continue to be used outside of their scope like that. Interesting.
I guess they must continue to persist due to their remaining reference. Thanks for info.

@ViperMaul ViperMaul added this to the CBA_A3_RC8 milestone Jun 1, 2015
ViperMaul added a commit that referenced this pull request Jun 2, 2015
CBA UI - params support in code exec
@ViperMaul ViperMaul merged commit 21c1025 into CBATeam:master Jun 2, 2015
@SzwedzikPL SzwedzikPL deleted the cba_ui_params branch June 2, 2015 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants